/**
 * 应用配置文件：元知app嵌套h5页面的配置文件
 * 正式环境打包命令：npm run build-um-prod
 * @Author: wenjm
 * @Date: 2018-03-01 22:49:24
 * @Last Modified by: wenjm
 * @Last Modified time: 2022-11-01 22:42:31
 */

// 项目的代理配置
let Proxy = require('../project-proxy')

// App后台访问地址
//let server = 'http://m.championsoft.net:22114'
let server = 'http://192.168.1.221:22114'
// 本地开发时App启动时访问的ip和端口号
let localServerIp = 'localhost'
let localServerPort = 9900

function getDateString(date = new Date()) {
    let month = date.getMonth() + 1;
    let monthString = (month < 10) ? '0' + month : month;
    return date.getFullYear() + '-' + monthString;
}

let config = {
    info: {
        id: 'com.championsoft.qjt',
        name: '齐建通',
        company: '广州市齐明软件科技有限公司',
        version: '1.0.0',
        telephone: '020-32204916',
        url: 'http://www.championsoft.cn/',
    },
    setting: {
        theme: 'default', //主题样式
        packageType: 'pc', // 打包类型，取值app、pc
        baiduMapAk: '9z9F4p3KYO8u1WpHn4xGISYQoEATXAXt',
        vconsole: true, // 是否开启vconsole调试工具，发布代码前记得改回 false
        initLogin: true, // 是否app启动时自动登录账号
        alwaysVerify: true, //即将删除该配置，请勿使用
        rsa: false, //即将删除该配置，请勿使用
        disableAwait: true, // 是否禁用页面等待数据才切换
    },
    //开发模式集成跨域代理服务，生产模式仅做URL替换
    //使用Hbuilder打包无需考虑跨域问题，纯web方式需符合同源策略
    proxy: {
        '/api': {
            target: server + '/mobileApi/',
            changeOrigin: true,
            secure:false,// 这是签名认证，http和https区分的参数设置
            // handlers: ["aes"],
            pathRewrite: {
                '^/api': '',
            },
        },
        '/admin': {
            target: server,
            changeOrigin: true,
            // handlers: ["aes"],
            pathRewrite: {},
        },
        '/smartform': {
            target: server + '/smartform/',
            changeOrigin: true,
            pathRewrite: {
                '^/smartform': '',
            },
        },
        '/workflow': {
            target: server,
            changeOrigin: true,
            pathRewrite: {},
        },
        '/ent': {
            target: server,
            changeOrigin: true,
            pathRewrite: {},
        },
        '/equipment': {
            target: server,
            changeOrigin: true,
            pathRewrite: {},
        },
        '/base': {
            target: server,
            changeOrigin: true,
            pathRewrite: {},
        },
        '/statistics': {
            target: server,
            changeOrigin: true,
            pathRewrite: {},
        },
        '/crane': {
            target: server,
            changeOrigin: true,
            pathRewrite: {},
        },
        '/external': {
            target: server,
            changeOrigin: true,
            pathRewrite: {},
        },
        '/commonSelect': {
            target: server + '/commonSelect/',
            changeOrigin: true,
            pathRewrite: {
                '^/commonSelect': '',
            },
        },
        "/app": {
            target: server,
            changeOrigin: true,
            pathRewrite: {
                "^/app": ""
            }
        },
        ...Proxy.init(server),
    },
    api: {
        login: '/api/base/account/login',
        getminiapp: '/api/app/mobileServer/getCurrentWindows',
        getuserServers: '/api/app/mobileServer/getMineServerOptions',
        vcode: '/api/account/vcode',
        videoServer: 'http://m.championsoft.net:12003/',
        update: server + '/mobileApi/base/AppUpdate/checkUpdate',
        upload: server + '/mobileApi/base/fileupload/uploadFile',
        download: server + '/mobileApi/base/fileupload/downFileUnify',
        downThumb: server + '/mobileApi/base/fileupload/downThumb',
        outsideDownThumb: server + '/openFileView/rhjg/attachment/download',
        typeDownload: server + '/mobileApi/base/fileupload/downLastFile',
        getFiles: '/api/base/fileupload/getFiles',
        delFile: '/api/base/fileupload/delFile',
        fileSavePath: '_doc/downloads/files/' + getDateString() + '/',
        localAvatarDir: '_doc/downloads/avatar/' + getDateString() + '/',
        cachePath: '_doc/downloads/cacheResource/' + getDateString() + '/',
        socket: server.replace('http', 'ws') + '/app/im/IMServer/',
        getRsaPublic: '/api/base/account/getRsaPublic',
        onlyoffice: 'http://m.championsoft.net:32002/web-apps/',
    },
    pages: {
        home: '/business/qzjx/index',
        // login: '/account/login',
        // 更换login页面路径
        login: '/ui/log-on/index',
        register: '/account/register/',
    },
    server: server,
    localServerIp: localServerIp,
    localServerPort: localServerPort,
}

module.exports = config
